package com.txl.cn.lc

import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by txl on 2018/7/28.
  */
object WordCount {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
      .setAppName("qwe")
      .setMaster("local[*]")
    val sc = new SparkContext(conf)
    val log = sc.textFile("data/wc.log")
    val splited = log.flatMap(_.split(" ")).map((_,1))
      .reduceByKey(_+_).sortBy(t=>(rt._2)).collect.foreach(println)
  }


}
